<template>
  <h2>Demo组件</h2>
  <button @click="clickBtn">测试</button><br>
  <slot name="test"></slot>
  <slot></slot>
</template>

<script>
import { ref } from 'vue'
export default {
  // setup 接收的第一个参数props, context 
  props: ['msg', 'name'],
  emits: ['hello'],
  setup(props, context) { 
    // console.log(context.emit)
    console.log(context) // 
    function clickBtn() {
      context.emit('sayHello', '张三')
    }
    return {
      clickBtn,
    }
  },
  mounted() {
    // console.log(this)
  }
}
</script>

<style lang="scss">

</style>